﻿namespace OutLook.Model.Charting
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Class fo calculation chart data (x;y)
    /// </summary>
    public static class ChartsData
    {
        public static List<KeyValuePair<double, double>> GetEnthalpyData()
        {
            List<KeyValuePair<double, double>> result = new List<KeyValuePair<double, double>>();
            double x = -2.49;
            double y = default(double);

            do
            {
                y = ChartCharacteristics.A * Math.Pow(x, 2) + ChartCharacteristics.B * x + ChartCharacteristics.C;
                result.Add(new KeyValuePair<double, double>(x, y));
                x += 0.01;
            } while (x <= -1.95);


            return result;
        }

        public static KeyValuePair<double, double> GetPointOnChartEnthalpy(double x)
        {
            double y = ChartCharacteristics.A * Math.Pow(x, 2) + ChartCharacteristics.B * x + ChartCharacteristics.C;
            KeyValuePair<double, double> result = new KeyValuePair<double, double>(x, y);

            return result;
        }

        public static List<KeyValuePair<double, double>> GetMetalSlagData()
        {
            List<KeyValuePair<double, double>> result = new List<KeyValuePair<double, double>>();
            double x = 0;
            double y = default(double);

            do
            {
                y = x;
                result.Add(new KeyValuePair<double, double>(x, y));
                x += 1;
            } while (x <= 150);


            return result;
        }

        public static List<KeyValuePair<double, double>> GetSlagPropertiesY1Data()
        {
            List<KeyValuePair<double, double>> result = new List<KeyValuePair<double, double>>();
            double x = 0.68;
            double y = default(double);

            do
            {
                y = Math.Pow(10, (191.6149 - 562.4018 * x + 401.948 * x * x + 6.74924 * (1000 / 1500)));
                result.Add(new KeyValuePair<double, double>(x, y));
                x += 0.001;
            } while (x <= 0.78);


            return result;
        }

        public static List<KeyValuePair<double, double>> GetSlagPropertiesY2Data()
        {
            List<KeyValuePair<double, double>> result = new List<KeyValuePair<double, double>>();
            double x = 0.68;
            double y = default(double);

            do
            {
                y = Math.Pow(10, (-9.8762 + 15.565 * x));
                result.Add(new KeyValuePair<double, double>(x, y));
                x += 0.001;
            } while (x <= 0.78);


            return result;
        }
    }
}
